<link rel="stylesheet" type="text/css" href="css/accourt.css"/>
<link rel="stylesheet" href="css/trecord.css" media="all" />
<link rel="stylesheet" href="css/page.css" media="all" />
<script type="text/javascript" src="js/Calendar.js"></script>
<script type="text/javascript" src="js/global/Date_func.js"></script>
<style>

.acctab td.tL{ text-align:left; padding-left:10px;}
.dname{height:18px; width:200px;}
#special_w{width:1200px;}
#special_dw{width:940px;}
</style>
<div class="r_content" id="special_dw">
    <h3 class="mc_title">
       <!-- <a class="mc_2" href="##"><span class="mctit_1"><span class="mctit_2">分销商交易管理</span></span></a>-->
       <span class="mctit_1 mctit_3"><a href="accountTrecord.html" class="mctit_2 mctit_4">分销商交易管理</a></span>
       <span class="mctit_1 mctit_3"><a href="accountSearch.html" class="mctit_2 mctit_4">账户余额查询</a></span>
       <span class="mctit_1"><span class="mctit_2">交易记录统计</span></span>
    </h3>
    <div class="accoinfo accos">
        <form id="searchBox">
            <input type="hidden" name="act" id="act" />
            <input type="hidden" name="timeT" id="timeT" value=""/>
            <ul class="search">
                <li class="time">
                    <span>&nbsp;&nbsp;&nbsp;分销商：</span>
                    <input type="text" class="dname" name="dname" value="<?=$_REQUEST['dname']?>"/>
                    <a href="javascript:void(0);" id="excel">导出Excel</a>
                </li>
                <li class="time">
                    <span>起止日期：</span>
                    <input type="text" name="beginDate" id="begintime" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" value="<?=$_REQUEST['beginDate']?>"/>
                    <label>至</label>
                    <input type="text" name="endDate"  id="endtime" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" value="<?=$_REQUEST['endDate']?>"/>
                    <a title="today" class="<?=$_REQUEST['timeT']=="today"?"current":""?>">今天</a>
                    <a title="yesterday" class="<?=$_REQUEST['timeT']=="yesterday"?"current":""?>">昨天</a>
                    <a title="week" class="<?=$_REQUEST['timeT']=="week"?"current":""?>">本周</a>
                    <a title="lastweek" class="<?=$_REQUEST['timeT']=="lastweek"?"current":""?>">上周</a>
                    <a title="month" class="<?=$_REQUEST['timeT']=="month"?"current":""?>">本月</a>
                    <a title="lastmonth" class="<?=$_REQUEST['timeT']=="lastmonth"?"current":""?>">上月</a>
                    <input type="submit" id="query" value="查询"/>
                </li>
            </ul>
        </form>
    </div>
    <div class="acclist">
        <table class="acctab">
            <thead>
                <tr>
                    <th class="tL">商户ID</th>
                    <th class="tL">商户名称</th>
                    <th>上期余额</th>
                    <th>充值</th>
                    <th>销售产品</th>
                    <th class="tR">分润</th>
                    <th class="tR">短信收入</th>
                    <th class="tR">凭证收入</th>
                    <th class="tR">退票收入</th>
                    <th class="tR">其他收入</th>
                    <th>提现</th>
                    <th>购买产品</th>
                    <th class="tR">手续费支出</th>
                    <th class="tR">短信支出</th>
                    <th class="tR">凭证支出</th>
                    <th class="tR">退票支出</th>
                    <th class="tR">其他支出</th>
                    <th class="tR">当期余额</th>
                </tr>
             </thead>
              <tbody id="tbody">
              <?if($r[0]!=""):?>
                <?foreach($r as $row):?>
                    <?php $i++;?>
                <tr class="<?=($i%2==1)?"odd":"even"?>">
                    <td><?=$row['fid']?><!--account--></td>
                    <td><?=$row['fid']?><!--dname--></td>
                    <td><?=$row['lastmoney']/100?></td>
                    <td><?=$row['recharge']/100?></td>
                    <td><?=$row['sell']/100?></td>
                    <td ><?=$row['profit']/100?></td>
                    <td class="income tR"><?=$row['msg']/100?></td>
                    <td class="pay tR"><?=$row['code']/100?></td>
                    <td class="pay tR"><?=$row['cancel']/100?></td>
                    <td class="lmoney tR"><?=$row['other']/100?></td>
                    <td><?=$row['cash']/100?></td>
                    <td><?=$row['buy']/100?></td>
                    <td class="lmoney tR"><?=$row['poundage']/100?></td>
                    <td class="income tR"><?=$row['msg2']/100?></td>
                    <td class="pay tR"><?=$row['code2']/100?></td>
                    <td class="pay tR"><?=$row['cancel2']/100?></td>
                    <td class="lmoney tR"><?=$row['other2']/100?></td>
                    <td class="lmoney tR"><?=$row['lmoney']/100?></td>
                </tr>
                <?php endforeach;?>
              <?php endif;?>
            <?if(count($r)==1&&$r[0]==""):?>
            <tr><td colspan="18" style="text-align:left; padding-left:60px;">请输入统计起止时间</td></tr>
            <?php endif;?>
            </tbody>
        </table>
        <?if(count($r)!=0){page($count,$currentPage,$pageSize);}?>
    </div>
</div>
<script>
    $(document).ready(function(){
        $("#tbody").on('click','a.show_order_relation', function(){
//            alert($(this).data('order'))
            var td = $(this).parent();
            $.getJSON('call/jh_prod.php',{action:'OrderRelationShip',ordernum:$(this).data('order')})
                    .done(function(json){
                        if (json.status=='ok') {
                            td.html(json.ret);
                        } else {
                            alert(json.msg);
                        }
                    })
        });
        $(".mc_2").click(function(){
            window.location="accountTrecord.html";
        })
    });
    $(".search li.time a").click(function(){
        var title=$(this).attr("title");
        Date_func.selectDate(title,document.getElementById("begintime"),document.getElementById("endtime"));
        $("#timeT").val(title)
        $("#searchBox").submit();
    })
    $(".search li.skey a").click(function(){
        var key=$(this).attr("key");
        $("#"+key).val($(this).attr("kvalue"));
        $("#searchBox").submit();
    })
    $("#excel").click(function(){
        $("#act").val("Export");
        $("form#searchBox").submit();
        $("#act").val("");
    });

</script>